#pragma GCC optimize(2)
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <vector>

using namespace std;
using LL = long long;
const int N = 2e5 + 10;
const LL INF = 1e18;

// [L[i], i - 1] [i, R[i]]
int n;
LL q[N];
LL sum[N];
int L[N], R[N], stk[N];
struct Node
{
    LL l, r, minv, maxv;
}node[N * 4];

void pushup(int u){
    node[u].maxv = max(node[u << 1].maxv, node[u << 1 | 1].maxv);
    node[u].minv = min(node[u << 1].minv, node[u << 1 | 1].minv);
}

void merges(Node& u, Node& p){
    u.maxv = max(u.maxv, p.maxv);
    u.minv = min(u.minv, p.minv);
}

void build(int u, int l, int r){
    if(l == r){
        node[u].l = l, node[u].r = r;
        node[u].maxv = node[u].minv = sum[l];
    }else{
        node[u].l = l, node[u].r = r;
        int mid = l + r >> 1;
        build(u << 1, l, mid), build(u << 1 | 1, mid + 1, r);
        pushup(u);
    }
}

Node query(int u, int l, int r){
    if(node[u].l >= l && node[u].r <= r){
        return node[u];
    }else{
        int mid = node[u].l + node[u].r >> 1;
        Node res = {0, 0, INF, -INF};
        
        if(mid >= l){
            Node t = query(u << 1, l, r);
            merges(res, t);
        }

        if(mid < r){
            Node t = query(u << 1 | 1, l, r);
            merges(res, t);
        }

        return res;
    }
}

void solve(){
    cin >> n;
    for(int i = 1; i <= n; i ++) cin >> q[i];
    for(int i = 1; i <= n; i ++){
        sum[i] = sum[i - 1] + q[i];
    }

    build(1, 0, n);

    int top = 0;
    stk[top] = 0;

    for(int i = 1; i <= n; i ++){
        while(top && q[stk[top]] <= q[i]) top --;

        L[i] = stk[top];
        stk[++top] = i; 
    }

    stk[top = 0] = n + 1;

    for(int i = n; i >= 1; i --){
        while(top && q[stk[top]] <= q[i]) top --;

        R[i] = stk[top];
        stk[++top] = i;
    }

    bool success = true;

    for(int i = 1; i <= n; i ++){
        Node miv = query(1, L[i], i - 1);
        Node mav = query(1, i, R[i] - 1);
    
        if(mav.maxv - miv.minv > q[i]){
            cout << "NO" << '\n';
            return;
        }
    }

    cout << "YES" << '\n';
    

}


int main(){
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int T;
    cin >> T;
    while(T--){
        solve();
    }
    return 0;
}